import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'

/* Layout */
import Layout from '@/layout/Layout' //引入想要的组件

//1、注入插件
Vue.use(Router)

//2、定义路由
export const constantRouterMap = [

    {
        path: '/login',
        name: '登录',
        hidden: true,
        component: () =>
            import ('@/views/login/login'),
    },



    { //每一个链接都是一个对象
        path: '/', //链接路径
        component: Layout, //对应的组件模板
        name: '首页',
        hidden: false,
        redirect: '/dashboard', //重定向
        children: [{
            path: 'dashboard',
            hidden: false,
            component: () =>
                import ('@/views/home/home'),
            name: '首页', //路由名称
            meta: {
                icon: 'el-icon-s-home',
            }
        }, ]

    },

    { //每一个链接都是一个对象
        path: '/project', //链接路径
        component: Layout, //对应的组件模板
        name: '项目管理',
        hidden: false,
        redirect: '/project', //重定向
        children: [{
            path: 'project',
            name: '项目管理',
            hidden: false,
            component: () =>
                import ('@/views/interface/project/projectManager'),
            meta: {
                icon: 'el-icon-s-flag',
            },
        }, ]

    },


    { //每一个链接都是一个对象
        path: '/interface', //链接路径
        component: Layout, //对应的组件模板
        name: '接口管理',
        hidden: false,
        redirect: '/interfaceManager', //重定向
        children: [{
                path: 'interfaceManager',
                name: '接口管理',
                hidden: false,
                component: () =>
                    import ('@/views/interface/interface/interfaceManager'),
                meta: {
                    icon: 'el-icon-s-management',
                }
            },
            {
                path: 'interfaceEdiet',
                name: '接口分组',
                hidden: false,
                component: () =>
                    import ('@/views/interface/interface/interfaceManager'),
                meta: {
                    icon: 'el-icon-s-flag',
                }
            },
        ]
    },


    { //每一个链接都是一个对象
        path: '/case', //链接路径
        component: Layout, //对应的组件模板
        name: '用例管理',
        hidden: false,
        redirect: '/caseManager', //重定向
        children: [{
                path: 'caseManager',
                name: '单用例管理',
                hidden: false,
                component: () =>
                    import ('@/views/interface/case/caseManager'),
                meta: {
                    icon: 'el-icon-suitcase',
                }
            },
            {
                path: 'batchCaseManager',
                name: '多用例管理',
                hidden: false,
                component: () =>
                    import ('@/views/interface/case/caseManager'),
                meta: {
                    icon: 'el-icon-suitcase',
                }
            },
        ]
    },

    { //每一个链接都是一个对象
        path: '/env', //链接路径
        component: Layout, //对应的组件模板
        name: '环境配置',
        hidden: false,
        redirect: '/env', //重定向
        children: [{
            path: 'env',
            name: '环境配置',
            hidden: false,
            component: () =>
                import ('@/views/interface/env/envManager'),
            meta: {
                icon: 'el-icon-s-order',
            }
        }, ]

    },

    {
        path: '/parameter', //链接路径
        component: Layout, //对应的组件模板
        name: '参数管理',
        hidden: false,
        redirect: '/parameter', //重定向
        children: [{
            path: 'parameter',
            name: '参数管理',
            hidden: false,
            component: () =>
                import ('@/views/interface/parameter/parametersManager'),
            meta: {
                icon: 'el-icon-setting',
            }
        }, ]

    },





    { //每一个链接都是一个对象
        path: '/function', //链接路径
        component: Layout, //对应的组件模板
        name: '功能菜单',
        hidden: false,
        redirect: '/directives', //重定向
        children: [

            {
                path: 'directives',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/directives'),
                name: '常用指令', //路由名称
                meta: {
                    icon: 'el-icon-s-tools',
                }
            },
            {
                path: 'bind&on&model',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/bindOrOnOrmodel'),
                name: '属性绑定和事件处理', //路由名称
                meta: {
                    icon: 'el-icon-s-tools',
                }
            },
            {
                path: 'lifeCycle',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/lifeCycle'),
                name: '生命周期', //路由名称
                meta: {
                    icon: 'el-icon-s-tools',
                }
            },
            {
                path: 'dynamicCSS',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/dynamicCSS'),
                name: '动态样式绑定', //路由名称
                meta: {
                    icon: 'el-icon-s-tools',
                }
            },
            {
                path: 'watch',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/watch'),
                name: '倾听器', //路由名称
                meta: {
                    icon: 'el-icon-s-tools',
                }
            },
            {
                path: 'calculationProperties',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/calculationProperties'),
                name: '计算属性',
                meta: {
                    icon: 'el-icon-s-tools',
                }

            },
            {
                path: 'template',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/template'),
                name: '组件通信',
                meta: {
                    icon: 'el-icon-s-tools',
                }

            },

            {
                path: 'filters',
                hidden: false,
                component: () =>
                    import ('@/views/baseFunction/filters'),
                name: '过滤器',
                meta: {
                    icon: 'el-icon-s-tools',
                }

            },



        ]

    },


    {
        path: '/interface/:interface_id',
        component: Layout,
        redirect: '/interface/:interface_id',
        name: '接口预览',
        hidden: true,
        children: [{
                path: '/interface/:interface_id',
                component: () =>
                    import ('@/views/interface/interface/interface'),
                name: '接口预览', //路由名称
                hidden: true,
                meta: {
                    title: '接口预览',
                    icon: 'el-icon-s-management',
                    affix: true,

                }
            },
            {
                path: '/case/:interface_id',
                component: () =>
                    import ('@/views/interface/case/case'),
                name: '用例预览', //路由名称
                hidden: true,
                meta: {
                    title: '用例预览',
                    icon: 'el-icon-s-management',
                    affix: true,

                }
            }
        ]
    },
]

//创建路由实例，且导出router实例
export default new Router({
    // mode: 'hash',
    mode: 'history',
    routes: constantRouterMap
})